package org.example.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.bean.SysUser;
import org.example.exception.BizException;
import org.example.result.ResultWrapper;
import org.example.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "系统用户",value = "sysUser")
@RestController
@RequestMapping("/sys/sysUser")
public class SysUserController {
    @Autowired
    private ISysUserService sysUserService;

    @GetMapping("/query")
    @ApiOperation(notes = "查询用户信息",value = "查询所有用户")
    public ResultWrapper<SysUser> getAllSysUser(){
        List<SysUser> list =sysUserService.list();
        ResultWrapper resultWrapper = new ResultWrapper<>();
        resultWrapper.setData(list);
        resultWrapper.setCode("200");
        resultWrapper.setMessage("操作成功");
//        if (true){
//            throw new BizException("403","未知异常");
//
//        }
        return resultWrapper;
    }
}

